package com.shd.edanpei.ui.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shd.edanpei.R;
import com.shd.edanpei.base.BaseQuickImageAdapter;
import com.shd.edanpei.bean.ProductBean;
import com.shd.edanpei.enums.OrderTypeEnum;

public class ProductAdapter extends BaseQuickImageAdapter<ProductBean> {

    private int mType;

    public ProductAdapter(Context context, int type) {
        super(context, R.layout.item_products);
        mType = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, ProductBean item) {
//        if (mType == 1) {
//            //上架产品
//            helper.getView(R.id.view_gray).setVisibility(View.GONE);
//        } else {
//            //下架产品
//            helper.getView(R.id.view_gray).setVisibility(View.VISIBLE);
//        }

        helper.setText(R.id.tv_type, OrderTypeEnum.getValue(item.getProductType()))
                .setText(R.id.tv_name, item.getName())
                .setText(R.id.tv_time, item.getCreateTime())
                .addOnClickListener(R.id.content)
                .addOnClickListener(R.id.delete);
    }
}
